﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Interpreter
{
	public class Metadata
	{
		// hacky and only here for ToString()
		// update: here for several things now, apparently. Must clean this up.
		public static Metadata _Instance;
		public Metadata()
		{
			Metadata._Instance = this;
		}

		public string ProgramRoot;

		public string[] IdTable;
		public Dictionary<string, int> IdReverseTable;
		public string[] StringTable;
		public int[] IntegerTable;
		public double[] FloatTable;

		public int[] OpCodeMap;
		public int[] ByteCodeToOpEnum;

		public int[][] Namespaces;

		public int[][] Constructors;
		public int[][] Fields;
		internal MethodSignature[] Methods;
		public int[][] PropertyGetters;
		public int[][] PropertySetters;

		public int[][] StaticConstructors;
		public int[][] StaticFields;
		internal MethodSignature[] StaticMethods;
		public int[][] StaticPropertyGetters;
		public int[][] StaticPropertySetters;

		public int[][] DefaultParameters;

		public int StartingPosition;

		public Dictionary<int, int[]>[] StaticClassMemberLookupGet;
		public Dictionary<int, int[]>[] StaticClassMemberLookupSet;
		public Dictionary<int, int[]>[] ClassMemberLookupGet;
		public Dictionary<int, int[]>[] ClassMemberLookupSet;

		public Value[] Classes;
		public int[][] ClassesFast;

		public int[] OpCodes;
		public int[] OpFirstParam;
		public int[][] OpMultiParam;

		public int[] PrimitiveMethodLookup;
		internal BuiltIns.NativeFunction[] NativeFunctions;

		public int SystemExceptionClassId;
		public int RuntimeExceptionInvoker;

		public int[][] ClassAncestry;

		internal FileInfo[] RawSource;
		internal Token[][] TokenInfo;
		internal string[] StackInfo;

		public Stack<int> ClassInitializationStack = new Stack<int>();
	}
}
